<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>News Search Engine</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
    <style type="text/css">
        div#doc {
            width: 800px
        }

        .pagination-page-info {
            padding: .6em;
            padding-left: 0;
            width: 40em;
            margin: .5em;
            margin-left: 0;
            font-size: 12px;
        }

        .pagination-page-info b {
            color: black;
            background: #6aa6ed;
            padding-left: 2px;
            padding: .1em .25em;
            font-size: 150%;
        }
        h1 {
            font-size: 50px; /* 设置h1标签的字体大小 */
            margin-top: 50px; /* 设置h1标签的顶部间距 */
        }

        h2 {
            font-size: 30px; /* 设置h2标签的字体大小 */
            margin-top: 16px; /* 设置h2标签的顶部间距 */
        }

        h3 {
            font-size: 20px; /* 设置h3标签的字体大小 */
            margin-top: 14px; /* 设置h3标签的顶部间距 */
        }

        body {
            font-family: Arial, sans-serif;
            background-color: #f5f5f5;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column; /* 垂直方向排列 */
        }

        .search-container {
            display: flex;
            width: 600px;
            margin-top: 30px;
            align-items: center;
        }

        .search-input,
        .search-button {
            flex: 1;
        }

        .search-input {
            padding: 10px;
            width: 500px;
            border: 1px solid #ccc;
            border-radius: 8px 0 0 8px;
            outline: none;
        }

        .search-button {
            padding: 10px;
            background-color: #4285f4;
            color: #fff;
            border: 1px solid #4285f4;
            border-radius: 0 8px 8px 0;
            cursor: pointer;
        }

        /* Hover effect for the button */
        .search-button:hover {
            background-color: #3a76e2;
        }
    </style>
</head>

<body>

    <h1 align="center">News Search Engine On HUPU</h1>
    <h2 align="center">虎扑搜索引擎</h2>
    <h3 align="center">组员：谢明昊 王一鸣 盛子森 戴隆超</h3>

    <div class="search-container">
        <form name="searchFunc" action="/search_web/" method="POST">
            {% if key %}
            <input type="text" name="key_word" class="search-input" value="{{key}}">
            {% else %}
            <input type="text" name="key_word" class="search-input" placeholder="Search...">
            {% endif %}
            <button type="submit" class="search-button">Search</button>
        </form>
    </div>

    <div class="container mt-5">

    {% if error%}
    {% for doc in docs%}
    <div id="doc">
        <ul id="navigation">
            <p><big><a href="/search/{{doc.id}}/" target="_blank">{{doc.title}}</a></big></p>
            <p>{{doc.time}}<br/>{{doc.snippet}}<br/>
                <a href="{{ doc.url }}" target="_blank">{{doc.url}}</a>
            </p>
        </ul>
    </div>
    <br/>
    {% endfor %}

    {% block next %}
    <ul>
        {% for i in page %}
        <a href="/search/page/{{i}}/">{{i}}</a>&nbsp;
        {% endfor %}
    </ul>
    {% endblock %}

    {% else %}
    <p>对不起，没有您搜索的网页！</p>
    {% endif %}

    </div>
</body>
</html>
